-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[22523] Fix path calculation #25479
[22523] Fix path calculation #25479
Conversation
@situchan @francoisl Please review. |
tests/unit/UrlTest.js
Outdated
expect(Url.getPathFromURL('http://foo.bar/?q=Test%20URL-encoded%20stuff')).toEqual(''); | ||
expect(Url.getPathFromURL('http://www.test.com/path?param=123#123')).toEqual('path'); | ||
expect(Url.getPathFromURL('http://foo.bar/?q=Test%20URL-encoded%20stuff')).toEqual('?q=Test%20URL-encoded%20stuff'); | ||
expect(Url.getPathFromURL('http://www.test.com/path?param=123#123')).toEqual('path?param=123'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#123
should not be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@situchan Done
@@ -18,7 +18,8 @@ function addTrailingForwardSlash(url) { | |||
*/ | |||
function getPathFromURL(url) { | |||
try { | |||
const path = new URL(url).pathname; | |||
const parsedUrl = new URL(url); | |||
const path = parsedUrl.pathname + parsedUrl.search + parsedUrl.hash; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be better way to get full path just removing host. Can you research on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@situchan We can obviously just slice the URL string and remove the host and just return the path but imo this is a better approach since we actually parse the URL to check if the URL is valid or not and also encodes some characters into valid URL characters like '%20'.
If we just slice the string and remove the host and return the rest of the string that isn't very efficient and that is how it was actually done previously.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-08-18.at.9.26.07.PM.movScreen.Recording.2023-08-18.at.9.27.28.PM.movMobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Sorry for not catching this earlier.
cc: @francoisl
That should not be caused by this PR |
@ayazhussain79 you should have commented on #23143. Seems like that PR is related to your screenshot. |
Well thank you I thought it might be because of this PR. |
🚀 Deployed to staging by https://github.com/francoisl in version: 1.3.56-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.56-24 🚀
|
Details
This PR is an extension of #24483 since we are using query parameters in attachment URLs and the previous implementation only catered pretty URLs and removed any query params in the path.
Fixed Issues
$ #22523
$ #24483 (comment)
PROPOSAL:
Original Proposal: #22523 (comment)
Proposal for this PR: #24483 (comment)
Tests
Offline tests
Same as above
QA Steps
Same as above
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
web.mov
Mobile Web - Chrome
mweb.chrome.mp4
Mobile Web - Safari
safari.mov
Desktop
desktop1.mov
iOS
ios.mov
Android
Android build is stuck locally and taking a long time.Will update once it is done.